<?php use_stylesheets_for_form($form) ?>
<?php use_javascripts_for_form($form) ?>

<?php if(!$module || $module == 'user') : ?>
<form action="<?php echo url_for('user/'.($form->getObject()->isNew() ? 'create' : 'update').(!$form->getObject()->isNew() ? '?id='.$form->getObject()->getId() : '')) ?>" method="post" <?php $form->isMultipart() and print 'enctype="multipart/form-data" ' ?>>
<?php elseif($module == 'infosUser') : ?>
<form action="<?php echo url_for('infosUser/update') ?>" method="post" <?php $form->isMultipart() and print 'enctype="multipart/form-data" ' ?>>
<?php endif; ?>
<?php echo $form->renderHiddenFields() ?>
    <?php if (!$form->getObject()->isNew()): ?>
<input type="hidden" name="sf_method" value="put" />
<?php endif; ?>
  <table class="formulaire">
      <thead>
          <tr><th colspan="3">Fiche utilisateur</th></tr>
      </thead>
    <tbody>
      <tr>
            <th>Prénom</th>
            <td><?php echo $form['first_name'] ?></td>
            <td><?php echo $form['first_name']->renderError() ?></td>
        </tr>
        <tr>
            <th>Nom</th>
            <td><?php echo $form['last_name']?></td>
            <td><?php echo $form['last_name']->renderError()?></td>
        </tr>
        <tr>
            <th>Adresse email</th>
            <td><?php echo $form['email_address']?></td>
            <td><?php echo $form['email_address']->renderError()?></td>
        </tr>
        <?php if (!$form->getObject()->isNew()): ?>
        <tr>
            <th>Mot de passe</th>
            <td><?php echo $form['password']?></td>
            <td><?php echo $form['password']->renderError()?></td>
        </tr>
        <tr>
            <th>Confirmation</th>
            <td><?php echo $form['password_bis']?></td>
            <td><?php echo $form['password_bis']->renderError()?></td>
        </tr>
        <?php else : ?>
        <tr>
            <th>Login</th>
            <td id="td_login"></td>
            <td><?php echo $form['username']->renderError()?></td>
        </tr>
        <tr>
            <th>Mot de passe</th>
            <td colspan="2" id="td_pass"></td>
        </tr>
        <?php endif; ?>
        </tbody>
        <tfoot>
        <tr>
          <th colspan="2">
            <input type="submit" value="Enregistrer" class="submit full"/>
            <?php if($module == 'user') : ?>
                <?php if($form->getObject()->isNew()) : ?>
                    <a href="<?php echo url_for('droitsUtilisateur/index') ?>" class="submit">Annuler</a>
                <?php else : ?>
                    <a href="<?php echo url_for('user/show?id='.$sf_guard_user->getId()) ?>" class="submit">Annuler</a>
                <?php endif; ?>
            <?php elseif($module == 'infosUser') : ?>
                <a href="<?php echo url_for('infosUser/index') ?>" class="submit">Annuler</a>
            <?php endif; ?>
        </th>
      </tr>
    </tfoot>
  </table>
</form>